//
// Created by jiangpenghui on 2023/5/26.
//

#ifndef CMAKECXX_THROW_NOEXCEPT_H
#define CMAKECXX_THROW_NOEXCEPT_H

#include <string>
#include <iostream>
#include <ratio>

void throw_run_error() noexcept(false);


template<typename T>
void foo_T(const T &val) {
    // 判断T 是否指针
    if (std::is_pointer<T>::value) {
        std::cout << "foo_T() called for a pointer" << std::endl;
    } else {
        std::cout << "foo_T called for a Value " << std::endl;
    }
}


template<typename T, T val>
struct integral_const {

    // 与const一致，在编译时确定value类型
    static constexpr T value = val;

    typedef T value_type;

    typedef integral_const<T, val> type;

    constexpr operator value_type() {
        return value;
    }
};

typedef integral_const<bool, true> true_type_1;
typedef integral_const<bool, false> false_type_2;


template<typename C>
void printClockData() {
    using namespace std;
    cout << " - precision";
    typedef typename C::period P;
    if (ratio_less_equal<P, milli>::value) {
        typedef typename ratio_multiply<P, kilo>::type TT;
        cout << fixed << double(TT::num) / TT::den << "  milliseconds" << endl;
    } else {
        cout << fixed << double(P::num) / P::den << " seconds" << endl;
    }

}


void print_time();

void time_time();

#endif //CMAKECXX_THROW_NOEXCEPT_H
